package kr.pe.johnkim.app.mobile.util;

import kr.pe.johnkim.app.domain.MyHistoryGroup;
import kr.pe.johnkim.app.domain.MyHistoryMember;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.providers.encoding.ShaPasswordEncoder;

import java.util.ArrayList;
import java.util.List;

/**
 * My History 공통 메소드들을 정의한 클래스이다.
 * 
 * @author : johnkim <cale9797@gmail.com / Simple.ly Inc,>
 * @Date : 11. 12. 23
 */
public class MyHistoryCommon {
    // SLF4J logging
    private Logger logger = LoggerFactory.getLogger(MyHistoryCommon.class);

    ShaPasswordEncoder encoder = new ShaPasswordEncoder();

    /**
     * 입력 받은 패스워드를 SHA 를 이용 해서 암호화 한 뒤 반환 한다.
     *
     * @param password
     * @return
     */
    public String getEncodedPassword(String password) {
        logger.info("getEncodedPassword");
        return encoder.encodePassword(password, null);
    }

    /**
     * 사용자를 등록할때 미리 정의 되어 있는 group 목록을 반환 한다.
     * 
     * @param myHistoryMember
     * @return
     */
    public List<MyHistoryGroup> getMyHistoryGroupList(MyHistoryMember myHistoryMember) {
        logger.info("getMyHistoryGroupList");

        List<MyHistoryGroup> groupList = new ArrayList<MyHistoryGroup>();

        MyHistoryGroup group01 = new MyHistoryGroup();
        group01.setName("FOOD");
        group01.setComment("음식 종류 입니다.");
        group01.setOpenGroupYn("N");
        group01.setFavoriteYn("N");
        group01.setActivateYn("Y");
        group01.setModifyDate(myHistoryMember.getModifyDate());
        group01.setRegisterDate(myHistoryMember.getRegisterDate());
        group01.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group01);

        MyHistoryGroup group02 = new MyHistoryGroup();
        group02.setName("DRINK");
        group02.setComment("음료 종류 입니다.");
        group02.setOpenGroupYn("N");
        group02.setFavoriteYn("N");
        group02.setActivateYn("Y");
        group02.setModifyDate(myHistoryMember.getModifyDate());
        group02.setRegisterDate(myHistoryMember.getRegisterDate());
        group02.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group02);

        MyHistoryGroup group03 = new MyHistoryGroup();
        group03.setName("PLAY");
        group03.setComment("놀이 종류 입니다.");
        group03.setOpenGroupYn("N");
        group03.setFavoriteYn("N");
        group03.setActivateYn("Y");
        group03.setModifyDate(myHistoryMember.getModifyDate());
        group03.setRegisterDate(myHistoryMember.getRegisterDate());
        group03.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group03);

        MyHistoryGroup group04 = new MyHistoryGroup();
        group04.setName("STUDY");
        group04.setComment("공부 관련된 내용들 입니다.");
        group04.setOpenGroupYn("N");
        group04.setFavoriteYn("N");
        group04.setActivateYn("Y");
        group04.setModifyDate(myHistoryMember.getModifyDate());
        group04.setRegisterDate(myHistoryMember.getRegisterDate());
        group04.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group04);

        MyHistoryGroup group05 = new MyHistoryGroup();
        group05.setName("MEETING");
        group05.setComment("만남 관련된 내용들 입니다.");
        group05.setOpenGroupYn("N");
        group05.setFavoriteYn("N");
        group05.setActivateYn("Y");
        group05.setModifyDate(myHistoryMember.getModifyDate());
        group05.setRegisterDate(myHistoryMember.getRegisterDate());
        group05.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group05);

        MyHistoryGroup group06 = new MyHistoryGroup();
        group06.setName("CULTURE");
        group06.setComment("문화생활에 관련된 내용들 입니다.");
        group06.setOpenGroupYn("N");
        group06.setFavoriteYn("N");
        group06.setActivateYn("Y");
        group06.setModifyDate(myHistoryMember.getModifyDate());
        group06.setRegisterDate(myHistoryMember.getRegisterDate());
        group06.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group06);

        MyHistoryGroup group07 = new MyHistoryGroup();
        group07.setName("SCHOOL");
        group07.setComment("학교에 관련된 내용들 입니다.");
        group07.setOpenGroupYn("N");
        group07.setFavoriteYn("N");
        group07.setActivateYn("Y");
        group07.setModifyDate(myHistoryMember.getModifyDate());
        group07.setRegisterDate(myHistoryMember.getRegisterDate());
        group07.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group07);

        MyHistoryGroup group08 = new MyHistoryGroup();
        group08.setName("COMPANY");
        group08.setComment("직장에 관련된 내용들 입니다.");
        group08.setOpenGroupYn("N");
        group08.setFavoriteYn("N");
        group08.setActivateYn("Y");
        group08.setModifyDate(myHistoryMember.getModifyDate());
        group08.setRegisterDate(myHistoryMember.getRegisterDate());
        group08.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group08);

        MyHistoryGroup group09 = new MyHistoryGroup();
        group09.setName("HOME");
        group09.setComment("가정에 관련된 내용들 입니다.");
        group09.setOpenGroupYn("N");
        group09.setFavoriteYn("N");
        group09.setActivateYn("Y");
        group09.setModifyDate(myHistoryMember.getModifyDate());
        group09.setRegisterDate(myHistoryMember.getRegisterDate());
        group09.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group09);

        MyHistoryGroup group10 = new MyHistoryGroup();
        group10.setName("EXERCISE");
        group10.setComment("운동에 관련된 내용들 입니다.");
        group10.setOpenGroupYn("N");
        group10.setFavoriteYn("N");
        group10.setActivateYn("Y");
        group10.setModifyDate(myHistoryMember.getModifyDate());
        group10.setRegisterDate(myHistoryMember.getRegisterDate());
        group10.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group10);

        MyHistoryGroup group11 = new MyHistoryGroup();
        group11.setName("HEALTH");
        group11.setComment("건강에 관련된 내용들 입니다.");
        group11.setOpenGroupYn("N");
        group11.setFavoriteYn("N");
        group11.setActivateYn("Y");
        group11.setModifyDate(myHistoryMember.getModifyDate());
        group11.setRegisterDate(myHistoryMember.getRegisterDate());
        group11.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group11);

        MyHistoryGroup group12 = new MyHistoryGroup();
        group12.setName("TIME");
        group12.setComment("시간에 관련된 내용들 입니다.");
        group12.setOpenGroupYn("N");
        group12.setFavoriteYn("N");
        group12.setActivateYn("Y");
        group12.setModifyDate(myHistoryMember.getModifyDate());
        group12.setRegisterDate(myHistoryMember.getRegisterDate());
        group12.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group12);

        MyHistoryGroup group13 = new MyHistoryGroup();
        group13.setName("BEAUTY");
        group13.setComment("미용에 관련된 내용들 입니다.");
        group13.setOpenGroupYn("N");
        group13.setFavoriteYn("N");
        group13.setActivateYn("Y");
        group13.setModifyDate(myHistoryMember.getModifyDate());
        group13.setRegisterDate(myHistoryMember.getRegisterDate());
        group13.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group13);

        MyHistoryGroup group14 = new MyHistoryGroup();
        group14.setName("SHOPPING");
        group14.setComment("쇼핑에 관련된 내용들 입니다.");
        group14.setOpenGroupYn("N");
        group14.setFavoriteYn("N");
        group14.setActivateYn("Y");
        group14.setModifyDate(myHistoryMember.getModifyDate());
        group14.setRegisterDate(myHistoryMember.getRegisterDate());
        group14.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group14);

        MyHistoryGroup group15 = new MyHistoryGroup();
        group15.setName("ETC");
        group15.setComment("기타 내용들 입니다.");
        group15.setOpenGroupYn("N");
        group15.setFavoriteYn("N");
        group15.setActivateYn("Y");
        group15.setModifyDate(myHistoryMember.getModifyDate());
        group15.setRegisterDate(myHistoryMember.getRegisterDate());
        group15.setMyHistoryMembersId(myHistoryMember.getId());
        groupList.add(group15);

        logger.info("groupList 리스트의 크기 : {}", groupList.size());

        return groupList;
    }
}
